package com.bestcem.xm.user.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.stream.Stream;

/**
 * 找回密码的类型枚举
 *
 * @author qiongyu.cui <qiongyu.cui@idiaoyan.com>
 * @version v1.0
 * @date 2022/5/26 21:20
 */
@Getter
@AllArgsConstructor
public enum FindPasswordTypeEnum {

    /**
     * 找回密码的类型枚举
     */
    EMAIL(1, "邮箱找回"),
    PHONE(2, "手机号找回");

    private Integer type;
    private String desc;

    /**
     * 根据类型获取枚举值
     *
     * @param type 类型
     * @return com.bestcem.xm.user.enums.FindPasswordTypeEnum
     * @author cuiqiongyu <qiongyu.cui@idiaoyan.cn>
     * @date 2022/05/26 21:27
     */
    public static FindPasswordTypeEnum getByType(Integer type) {
        return Stream.of(values()).filter(s -> s.getType().equals(type)).findFirst().orElse(null);
    }

}
